package com.sdy.healthcode.mq.config;

import com.sdy.healthcode.biz.constants.MqConstants;
import com.sdy.healthcode.mq.consumer.DemoMessageConsumer;
import com.sdy.mq.base.BaseMessageListener;
import com.sdy.mq.config.RocketMqConfig;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ConsumerGroupConfig {
    @Autowired
    private RocketMqConfig rocketMqConfig;
    @Autowired
    private DemoMessageConsumer demoMessageConsumer;
    
//    @Bean
    public DefaultMQPushConsumer demoMessageListener() throws Exception {
        return rocketMqConfig.createConsumerGroup("consumer_group_healthcode_demo", new BaseMessageListener(demoMessageConsumer), MqConstants.Topics.TOPIC_DEMO);
    }
}
